--pieces
local base = piece("base")
  body = piece("body") 
    local engine1, engine2 = piece("engine1", "engine2")
    local turret, sleeve = piece("turret", "sleeve1")
      local barrel1a, firepoint1a = piece("barrel1a", "firepoint1a")  
      local barrel1b, firepoint1b = piece("barrel1b", "firepoint1b")	

scriptParams = {
  smokePieces = { body },
  enginePieces = { engine1, engine2 },
  smokeDelay = 300,
  maxRockAngleX = 5,
  maxRockAngleZ = 5,
  rockOnMove = true,

  weapons = {
    [1] = {
      turretTurnSpeed = 70,
      sleeveTurnSpeed = 40,
	    barrelRecoil = 3,
	    rockForce = 150,
	    minPitch = -10,
	    --cegID = 1,
	    restores = true,
      --restoreDelay = 3000,
      --openAnimation = true,	  
    },
  }  
}

Spring.Echo(tostring(TROLOLO1) .. " " .. tostring(GG.TROLOLO2))

include "pre_scripts.lua"

setWeaponPieces(1, turret, sleeve, { barrel1a, barrel1b }, { firepoint1a, firepoint1b })

include "scripts.lua"


function script.Killed (recentDamage, maxHealth)
  local severity = recentDamage / maxHealth
  
  Explode (engine1, SFX.NONE)
  Explode (engine2, SFX.NONE)  
  Explode (firepoint1a, SFX.NONE)
  Explode (firepoint1b, SFX.NONE)  
  if (severity <= 0.25) then
    Explode (body, SFX.NONE)
    Explode (turret, SFX.NONE)
    Explode (sleeve, SFX.NONE)
    Explode (barrel1a, SFX.NONE)
    Explode (barrel1b, SFX.NONE)	
	  return 1
  elseif (severity <= 0.50) then
    Explode (body, SFX.NONE)
    Explode (turret, SFX.NONE)
    Explode (sleeve, SFX.SMOKE + SFX.FIRE)  --SFX.NONE
    Explode (barrel1a, SFX.SMOKE + SFX.FIRE)
    Explode (barrel1b, SFX.SMOKE + SFX.FIRE)
	  return 2
  else
    Explode (body, SFX.SHATTER)
    Explode (turret, SFX.SHATTER)
    Explode (sleeve, SFX.SMOKE + SFX.FIRE + SFX.EXPLODE)  --SFX.SHATTER
    Explode (barrel1a, SFX.SMOKE + SFX.FIRE + SFX.EXPLODE)
    Explode (barrel1b, SFX.SMOKE + SFX.FIRE + SFX.EXPLODE)
	  return 3
  end
end